home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Georgia Wildfire Prevention
/
Georgia Wildfire Prevention.iso
/
pc
/
media
/
dirs
/
BackUp
/
Login.dir
/
00006_Script_KeyPad Behavior
< prev
next >
Wrap
Text File
|
2002-10-11
|
3KB
|
90 lines
--KeyPad Behavior--
--This behavior operates the keypad.
--PROPERTIES--
--RollOvr: This is the member that will be used on a roll-over.
--ButtonSound: The sound played when a button is pressed.
--Keystroke: The keyboard key corresponding to the graphic. (i.e. A on the keyboard will activate the graphic key "A").
--spNum: The sprite number.
--MyNum: The member's number.
global HotField
property RollOvr, ButtonSound, KeyStroke, spNum, MyNum,
on new me
spNum = me.spritenum
MyNum=sprite(SpNum).member.number
set TheKey = ""
end
--Creates dialog box for properties.
on getpropertydescriptionlist me
set pList = [#RollOvr: [#comment: "What member will be used for the rollover?", #format:#string, #default: ""],\
#ButtonSound: [#comment: "What sound would you like to play when pressed?", #format:#string, #default:""],\
#KeyStroke: [#comment:"What keyboard key does this button correspond to?", #format:#string, #default:""]]
return pList
end
--If the user types with the keyboard, the corresponding key on the pad will go down (become transparent).
on KeyBoardDown me,
set theKey = the keypressed
if (theKey = numtochar (13)) or (theKey = numtochar (9)) then
theKey = "RETURN"
else if (theKey = numtochar (8)) or (theKey = numtochar(127)) then
theKey = "BACKSPACE"
end if
if theKey = keystroke then
sound(2).play(member(ButtonSound))
sprite(spNum).blend = 0
updatestage
set TimeTracker = the ticks
repeat while the ticks < (TimeTracker + 5) then
nothing
end repeat
sprite(spNum).blend = 100
end if
end
--This is for the rollover.
on mouseenter me
sprite(SpNum).membernum = member(RollOvr).number
sprite(SpNum).cursor = 280
updateStage
end
on mouseleave me
sprite(SpNum).membernum = member(MyNum).number
sprite(SpNum).cursor = 293
updateStage
end
on mousedown me
if KeyStroke = "RETURN" then--If the user presses RETURN (ENTER key on the PC) or TAB the next field goes active.
case (HotField) of
"First Name" : HotField = "Last Name"
"Last Name" : HotField = "Address"
"Address" : HotField = "City"
"City" : Hotfield = "State"
"State" : HotField = "Zip Code"
"Zip Code" : HotField = "Age"
"Age" : Hotfield = "First Name"
end case
end if
sprite(spNum).blend = 0
sound(2).play(member(ButtonSound))
sendallsprites (#FieldFiller, KeyStroke)
end
on mouseupoutside
sprite(spNum).blend = 100
on mouseup
sprite(spNum).blend = 100
end